<!--
  To change this template, choose Tools | Templates
  and open the template in the editor.
-->

<%@ page contentType="text/html;charset=UTF-8" %>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>New Customer for ${Taller.name}</title>
    <meta name="layout" content="main">
  </head>
  <body>
    <br>
    <g:link class="list" action="newCustomer">
      <div class="tabSelected">
        Customer
      </div>
    </g:link>
    <g:link class="list" action="newMechanical">
      <div class="tabNoSelected">
        Mechanical Technician
      </div>
    </g:link>
    <g:link class="list" action="newServicePackage">
      <div class="tabNoSelected">
          Services Packages
      </div>
    </g:link>
    <g:link class="list" action="edit" id="${Taller.id}">
      <div class="tabNoSelected">
       Edit My data
      </div>
    </g:link>   
    <g:link class="list" action="logout" controller="LogIn">
      <div class="tabNoSelected">Log Out</div>
    </g:link>
    <div class="tabContent"> 
      <g:link class="list" action="newCustomer" >
        <div class="tabSelected">
          New
        </div>
      </g:link>
      <g:link class="list" action="listCustomer" >
        <div class="tabNoSelected">
          List
        </div>
      </g:link>
    </div>
    <hr>
    <div>
      <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
      </g:if>
      <g:hasErrors bean="${customerInstance}">
      <ul class="errors" role="alert">
              <g:eachError bean="${customerInstance}" var="error">
              <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
              </g:eachError>
      </ul>
      </g:hasErrors>
      <g:form action="saveCustomer">
      <fieldset class="form">
      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'identification', 'error')} required">
	<label for="identification">
		<g:message code="customer.identification.label" default="Identification" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="identification" required="" value="${customerInstance?.identification}"/>
      </div>

      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'email', 'error')} required">
	<label for="email">
		<g:message code="customer.email.label" default="Email" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="email" required="" value="${customerInstance?.email}"/>
      </div>
        
      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'email', 'error')} required">
	<label for="confirmEmail">
		<g:message code="customer.email.label" default="Confirm email" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="email" name="confirmEmail" required="" value="${customerInstance?.confirmEmail}"/>
      </div>
      
      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'name', 'error')} required">
	<label for="name">
		<g:message code="customer.name.label" default="Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="name" required="" value="${customerInstance?.name}"/>
      </div>

      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'password', 'error')} required">
	<label for="password">
		<g:message code="customer.password.label" default="Password" />
		<span class="required-indicator">*</span>
	</label>
	<g:passwordField name="password" maxlength="15" required="" value="${customerInstance?.password}"/>
      </div>
        
      <div class="fieldcontain ${hasErrors(bean: repairShopInstance, field: 'password', 'error')} required">
	<label for="confirmPassword">
		<g:message code="Confirm Password" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="password" name="confirmPassword" maxlength="15" required="" value="${repairShopInstance?.confirmPassword}"/>
      </div>

      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'address', 'error')} ">
	<label for="address">
		<g:message code="customer.address.label" default="Address" />
		
	</label>
	<g:textField name="address" value="${customerInstance?.address}"/>
      </div>

      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'phoneNumber', 'error')} ">
	<label for="phoneNumber">
		<g:message code="customer.phoneNumber.label" default="Phone Number" />
		
	</label>
	<g:textField name="phoneNumber" value="${customerInstance?.phoneNumber}"/>
      </div>

      <div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'repairShop', 'error')} required">
	<g:hiddenField name="repairShop.id" value="${Taller.id}"/>
      </div>
    </div>
    </fieldset>
      <fieldset class="buttons">
        <g:submitButton name="create" class="save" value="${message(code: 'Create')}" />
      </fieldset>
    </g:form>
  </body>
</html>
